<template>
	<view class="top">
		<view class="" v-for="(item,index) in serviceList" :key="index">
			<uni-card padding="0" spacing="0" style="border-radius: 10px;margin-top: 0px;"
				@click="toserviceList(item.id)">
				<template v-slot:cover>
					<view class="custom-cover">
						<image style="height: 200px;border-radius: 10px;margin: 10px 0;"
							src="../../../static/images/ly/优惠券.jpg"></image>
					</view>
				</template>
				<text
					style="font-weight: bold; margin-top: 20rpx; margin-left: 20rpx; font-size: 28rpx;">{{item.name}}</text>
				<text style="margin-left: 500rpx;font-size: 28rpx;font-weight: bold;">></text>
			</uni-card>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				serviceList: []
			}
		},
		onLoad() {
			this.getServiceList();
		},
		methods: {
			toserviceList(id) {
				uni.$u.route(`/pages/ly/buy/buy2?id=${id}`)
			},
			getServiceList() {
				let that = this;
				this.$http({
					url: '/api/service/service/list',
					method: 'GET',
					success(res) {
						that.serviceList = res.data.rows
						console.log(that.serviceList)
					}
				})
			}
		}
	}
</script>

<style>
	.top {
		height: 150px;
		background-image: url(../../../static/images/ly/组 6.png);

	}

	.custom-cover {
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>